﻿using System.Collections;
using System.ComponentModel;
using System.ServiceProcess;
using uTILLIty.Rave.Service.Properties;

namespace uTILLIty.Rave.Service
{
	[RunInstaller(true)]
	public class RaveServiceInstaller : ServiceInstaller
	{
		public RaveServiceInstaller()
		{
			Description = Resources.ServiceDescription;
			DisplayName = AddSuffix("DirCreator", Settings.Default.ServiceDisplayNameSuffix);
			ServiceName = AddSuffix("DirCreator", Settings.Default.ServiceNameSuffix);
			StartType = ServiceStartMode.Automatic;
			DelayedAutoStart = Settings.Default.ServiceDelayedStart;
		}

		private string AddSuffix(string prefix, string suffix)
		{
			return string.IsNullOrWhiteSpace(suffix) ? prefix : prefix + suffix;
		}
	}
}